import { Controller, Post, UploadedFile } from '@nestjs/common';
import { UploadFileService } from './upload-file.service';
import { fileFilter, upload } from 'src/utils/upload';
import { resultUtil } from 'src/utils/result';

@Controller('upload-file')
export class UploadFileController {
  constructor(private readonly uploadFileService: UploadFileService) {}

  @Post('image')
  @upload('file', {
    fileFilter: fileFilter('image'),
  })
  create(@UploadedFile() file: Express.Multer.File) {
    
    // return file;
    return resultUtil('', '000000', {...file})
  }
}
